#from ROOT import gRandom,TCanvas,TH1F
#c1 = TCanvas('c1','Example',200,10,700,500)
#hpx = TH1F('hpx','px',100,-4,4)
#for i in xrange(25000):
#   px = gRandom.Gaus()
#   hpx.Fill(px)
#hpx.Draw()
#c1.Update()

## selecting jobs
import re

jlist = jobs.select(application='AthenaTask')
jlist_data = []
jlist_mc   = []
re_data = re.compile('.*(data10|group).*')
re_mc   = re.compile('.*(mc09|Richard).*')
for j in jlist:
    if re_data.match(j.inputdata.dataset[0]):
        jlist_data.append(j)
    elif re_mc.match(j.inputdata.dataset[0]):
        jlist_mc.append(j)

## creating TTree
from job_data_proc import make_root_ttree

make_root_ttree('amaevent_main_data_jtree.root', jlist_data)
make_root_ttree('amaevent_main_mc_jtree.root'  , jlist_mc)
